{include file="common/header" /}
<div class="main layui-clear">
    <div class="wrap">
        <div class="content" style="margin-right:0">
            <div class="fly-tab">
                <div class="layui-tab layui-tab-brief">
                    <ul class="layui-tab-title">
                        <li><a href="{:url('index/index/index')}">首页</a></li>
                        <li {eq name="type" value="all"} class="layui-this" {/eq}><a href="{:url('index/forum/index')}">全部帖</a></li>
                        <li><a href="{:url('index/forum/index',['type'=>'unsolved'])}" {eq name="type" value="unsolved"} class="layui-this" {/eq}>未结帖</a></li>
                        <li><a href="{:url('index/forum/index',['type'=>'solved'])}" {eq name="type" value="solved"} class="layui-this" {/eq}>已采纳</a></li>
                        <li><a href="{:url('index/forum/index',['type'=>'wonderful'])}" {eq name="type" value="wonderful"} class="layui-this" {/eq}>精华帖</a></li>
                        {notempty name="user.id"}<li><a href="{:url('index/user/index')}">我的帖</a></li>{/notempty}
                    </ul>
                </div>
                <i class="layui-icon fly-search"></i></div>
            {notempty name="list"}
            <ul class="fly-panel fly-list">
                {foreach name="list" item="vo"}
                <li class="fly-list-li">
                    <a href="{:url('index/user/home',['uid'=>$vo['uid']])}" class="fly-list-avatar">
                        <img src="{$vo.avatar}" alt="{$vo.username}">
                    </a>
                    <h2 class="fly-tip">
                        <a href="{:url('index/forum/detail',['tid'=>$vo['id']])}">{$vo.title}</a>
                        {eq name="$vo.top" value="1"}<span class="fly-tip-stick">置顶</span>{/eq}
                        {eq name="$vo.elite" value="1"}<span class="fly-tip-jing">精帖</span>{/eq}
                    </h2>
                    <p>
                        <span><a href="{:url('index/user/home',['uid'=>$vo['uid']])}">{$vo.username}</a></span>
                        <span>{$vo.add_time}</span>
                        <span>{$vo.catename}</span>
                        <span class="fly-list-hint">
              <i class="iconfont" title="回答">&#xe60c;</i> {$vo.reply}
              <i class="iconfont" title="人气">&#xe60b;</i> {$vo.view}
            </span>
                    </p>
                </li>
                {/foreach}
            </ul>
            {else /}
            <div class="fly-none">并无相关数据</div>
            {/notempty}
            <!--<div style="text-align: center;margin-top: 25px;">
                <div id="pages"></div>
            </div>-->
            <div style="text-align: center">
                <div class="laypage-main"><!--<span class="laypage-curr">1</span><a href="/jie/page/2/">2</a><a
                        href="/jie/page/3/">3</a><a href="/jie/page/4/">4</a><a
                        href="/jie/page/5/">5</a><span>…</span><a href="/jie/page/148/" class="laypage-last" title="尾页">尾页</a><a
                        href="/jie/page/2/" class="laypage-next">下一页</a>-->
                    {$list->render()}
                </div>
            </div>

        </div>
    </div>
</div>
{include file="common/footer" /}
<!--
<script src="__RES__js/jquery.min.js?v={$site_version}"></script>
<script src="__RES__/layui/lay/modules/laytpl.js?v={$site_version}"></script>
<script src="__RES__/layui/lay/modules/laypage.js?v={$site_version}"></script>
<script type="text/javascript">
    //以下将以jquery.ajax为例，演示一个异步分页
    function page(curr){
        var laypage = layui.laypage;
        var type="{$type}";
        $.get('/forum/getIndex', {type: type,page: curr || 1
        }, function(res){
            $(".fly-list").empty().html();
            var data = res.lists;
            console.log(data);
            //遍历聊天记录
            for(var i in data){
                var top=(data[i].top==1)?'<span class="fly-tip-stick">置顶</span>':''; //判断是否自己发送
                var elite=(data[i].elite==1)?'<span class="fly-tip-jing">精帖</span>':''; //判断是否自己发送
                //对话列表渲染
                var html='<li class="fly-list-li"><a href="{:url("index/user/home",["uid"=>"' + data[i].uid + '"])}" class="fly-list-avatar"><img src="'+data[i].avatar+'" alt=""></a><h2 class="fly-tip"><a href="{:url("index/forum/detail",["tid"=>"'+data[i].id+'"])}">'+data[i].title+'</a>'+top+''+elite+'</h2><p><span><a href="{:url("index/user/home",["uid"=>"'+data[i].uid+'"])}">'+data[i].username+'</a></span><span>'+data[i].add_time+'</span><span>'+data[i].catename+'</span><span class="fly-list-hint"><i class="iconfont" title="回答">&#xe60c;</i> '+data[i].reply+'<i class="iconfont" title="人气">&#xe60b;</i> '+data[i].view+'</span></p></li>';
                //列表追加到面板
                $(".fly-list").append(html);
            }
            //显示分页
            laypage({
                cont: 'pages', //容器。值支持id名、原生dom对象，jquery对象。【如该容器为】：<div id="page1"></div>
                pages: res.allpage,     // 总页数(后台的)
                curr: res.nowpage, //当前页(后台获取到的)
                //curr: location.hash.replace('#!fenye=', ''), //获取hash值为fenye的当前页
                first: false,
                last: false,
                hash: 'page', //自定义hash值
                jump: function(obj, first){ //触发分页后的回调
                    if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
                        page(obj.curr);
                    }
                }
            });
        },'json');
    };
    //运行
    page();
</script>-->
